Skip to content

Комаров Ярослав#7

Open
YaroslavKomarov wants to merge 2 commits intoRTF-Angular-2021:masterfrom
YaroslavKomarov:Yaroslav-Komarov
Open

Комаров Ярослав#7
YaroslavKomarov wants to merge 2 commits intoRTF-Angular-2021:masterfrom
YaroslavKomarov:Yaroslav-Komarov

Conversation

@YaroslavKomarov
Copy link

No description provided.

return `result of the addition operation ${this.a} + ${this.b} = ${this.wrappee.exec()}`;
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 бала, верная реализация

class Example {
@decoratorProp
public email: string = "";
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 бала

}

public register<?>(type: ?) {
public register(type: Function) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут нужно было делать использую generic-типы. не правильно

selectBoxInstance.setValue("sdfsdf") // компилятор TS не пропускает
selectBoxInstance.setValue(new SelectItem()) // компилятор TS пропускает
//selectBoxInstance.setValue("sdfsdf") // компилятор TS не пропускает
selectBoxInstance.setValue(new SelectItem()) // компилятор TS пропускает No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не верная реализация.
Метод register класса FactoryControl позволит зарегистрировать всё что угодно (а надо было только то что унаследовано от класса Control) а значит и не будет проверок компилятором TypeScript на передаваемый тип потому что там используется абстрактное ограничение Function, т.е. любой тип

const x = {
m: 12,
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 бала

* Если поле не заполнено, то генерируется эксепшен.
*/
function validate(target: Object, propKey: string): any {
if (!(propKey in Object.keys(target) && (target as any)[propKey])) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

на данный момент это не работает для теста можно использовать

let example = new Example1();
example.propValueExample1 = new ValueExample1();
example.propValueExample1 = new ValueExample2();

Что бы проверить наличие свойства у объекта, можно использовать reflect-metadata или просто создать объект и посмотреть есть ли у него это поле.


@validate(ValueExample2, "booleanProp")
public propValueExample2: any;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Работает не верно

let example = new Example1();
example.propValueExample1 = new ValueExample1();
example.propValueExample1 = new ValueExample2();

попробуй проверить

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Оооооочень долго не мог понять, почему у меня проходит без проблем тест, который Вы предложили опробовать. Оказывается я определил конструкторы для ValueExample1 и 2, с присвоением значений по умолчанию и поля всегда были проинициализированны. Крч, не туда воевал

@m-abrosimov
Copy link

итого 9 балов

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants